﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FNSShoppingCart;
public partial class Pages_WebControls_ShoppingCart : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        var cart = new MyShoppingCart();
        var cartID = cart.GetShoppingCartId();
        int nrProd = cart.GetNumberOfProducts(cartID);
        decimal totalprice = cart.GetTotal(cartID);
        if (nrProd > 0 && totalprice > 0)
        {
            ShoppingCart.Visible = true;
            ItemsBought.Text = nrProd + " produse";
            TotalPrice.Text = String.Format("{0:0,0.##} RON",totalprice);
        }
    }
}